<?php
namespace Zxf5115\Laravel\Kernel\Controllers;

use Illuminate\Http\Request;
use Illuminate\Http\JsonResponse;
use Illuminate\Routing\Controller;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Zxf5115\Laravel\Kernel\Traits\ControllerTrait;

/**
 * @author zhangxiaofei [<1326336909@qq.com>]
 * @dateTime 2025-09-11
 *
 * 基础控制器类
 *
 * 提供所有控制器的通用功能和配置
 */
abstract class BaseController extends Controller
{
  use AuthorizesRequests, DispatchesJobs, ValidatesRequests, ControllerTrait;

  /**
   * 构造方法
   */
  public function __construct()
  {
    $this->resolveModelClass(static::class);
  }

  /**
   * 默认首页
   *
   * @param Request $request 用户请求参数
   * @return JsonResponse 响应数据
   */
  public function index(Request $request) : JsonResponse
  {
    return success(__('kernel.request_success'));
  }
}
